package com.rou.im.framework.core.exception;

/**
 * <p>
 * 普通的自定义异常，整个框架都需要继承这个异常
 * </p>
 *
 * @author GaoShuangWen
 * @since 2020-05-13 22:25
 */
public class CommonRuntimeException extends RuntimeException implements IndexedMessage{

    /**
     * 自定义异常码
     */
    private String code;

    private Object[] params;


    public CommonRuntimeException(String code, Throwable e, Object... params) {
        super(e);
        this.code = code;
        this.params = params;
    }

    public CommonRuntimeException(String code, Object... params) {
        this(code, null, params);
    }

    public CommonRuntimeException(Throwable e) {
        this(null, e);
    }

    public CommonRuntimeException() {

    }

    @Override
    public String getMessage() {
        return super.getMessage();
    }


    @Override
    public String getCode() {
        return this.code;
    }

    @Override
    public Object[] getParams() {
        return this.params;
    }
}
